package work.jame.blog.framework.utils;

import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * @author : Jame
 * @date : 2023-04-15 09:05
 **/
public class ThreadPoolUtil {

    private static final ThreadPoolExecutor THREAD_POOL_EXECUTOR = new ThreadPoolExecutor(
            2,
            10,
            300,
            TimeUnit.SECONDS,
            new LinkedBlockingDeque<>(40),
            new ThreadPoolExecutor.AbortPolicy());

    /**
     * 执行任务
     * @param task
     */
    public static void execute(Runnable task) {
        THREAD_POOL_EXECUTOR.execute(task);
    }


}
